/*    */ package com.infoservice.schedule.generator;
/*    */ 
/*    */ import java.util.Hashtable;
/*    */ import java.util.Map;
/*    */ import java.util.Timer;
/*    */ import java.util.TimerTask;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class TaskTimer extends Timer
/*    */ {
/* 29 */   private Logger logger = Logger.getLogger(TaskTimer.class);
/* 30 */   private Map<Long, TimerTask> taskMap = new Hashtable();
/*    */ 
/*    */   public TaskTimer(String name) {
/* 33 */     super(name);
/*    */   }
/*    */ 
/*    */   public void addTaskGen(TaskGenerator task) {
/* 37 */     this.logger.debug("TaskGentrator task info ==========\n" + task.tpInfo.toString() + ", \ndelay time=" + task.getDelayTime() + ", \n period time=" + task.getPeriodTime());
/* 38 */     scheduleAtFixedRate(task, task.getDelayTime(), task.getPeriodTime());
/* 39 */     this.taskMap.put(task.tpInfo.getPlanId(), task);
/* 40 */     this.logger.debug("taskMap================" + this.taskMap);
/*    */   }
/*    */   public void addOnlyOneTaskGen(TaskGenerator task) {
/* 43 */     schedule(task, task.getDelayTime());
/* 44 */     this.taskMap.put(task.tpInfo.getPlanId(), task);
/*    */   }
/*    */   public void remove() {
/* 47 */     cancel();
/*    */   }
/*    */ 
/*    */   public void removeTask(long planId) {
/* 51 */     this.logger.info("终止任务:" + planId + "开始...");
/* 52 */     ((TimerTask)this.taskMap.get(Long.valueOf(planId))).cancel();
/* 53 */     this.logger.info("终止任务:" + planId + "成功");
/*    */   }
/*    */ }

/* Location:           D:\Workspace\Work\ASMP_DE\lib\frame3\InfoSchedule_1.0.03.jar
 * Qualified Name:     com.infoservice.schedule.generator.TaskTimer
 * JD-Core Version:    0.6.0
 */